//
//  MovieListCell.m
//  DaHaiDouBan
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 Wang Dahai. All rights reserved.
//

#import "MovieListCell.h"
#import "UIImageView+WebCache.h"
@implementation MovieListCell
- (void)dealloc
{
    [_backGroundImageView release];
    [_nameLabel release];
    [_headImageView release];
    [_movie release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
    }

    return self;
    
}
-(void)createSubviews
{
    //背景篮筐
    self.backGroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 129)];
    self.backGroundImageView.image = [UIImage imageNamed:@"bg_eventlistcell@2x"];
    [self.contentView addSubview:self.backGroundImageView];
    [_backGroundImageView release];
    //电影图片框
    self.headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 80, 117)];
    [self.backGroundImageView addSubview:self.headImageView];
    [_headImageView release];
    //电影名标签
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 30, 200, 40)];
    //self.nameLabel.backgroundColor = [UIColor cyanColor];
    [self.backGroundImageView addSubview:self.nameLabel];
    [_nameLabel release];

    
}

-(void)setMovie:(Movie *)movie
{
    if (_movie != movie) {
        [_movie release];
        
        _movie = [movie retain];
        
    }
    self.nameLabel.text = _movie.movieName;
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:_movie.pic_url] placeholderImage:[UIImage imageNamed:@"picholder@2x"]];
    
}








- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
